<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>账户信息</title>
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/app.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"><span>返回</span></a>
			<a class="mui-icon mui-icon-checkmarkempty mui-pull-right" id="submit"></a>
			<h1 class="mui-title" id="title"></h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group">
				<div class="mui-input-row" style="margin-top: 35px;vertical-align: center;">
					<input id="edit-input" name="Value" type="text" value="" placeholder="">
				</div>
			</form>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script type="text/javascript" src="../../js/mui-extend.min.js" ></script>
		<script type="text/javascript" src="../../js/app.js" ></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();
			mui.plusReady(function() {
				var current = plus.webview.currentWebview();
				document.getElementById("title").innerHTML = current.title;
				document.getElementById("edit-input").value = current.value;
				document.getElementById("edit-input").placeholder = current.title;
				showPage(current);
				mui(".mui-bar-nav").on("tap", "#submit", function(e) {
					var att = plus.webview.currentWebview().attribute;
					var value = document.getElementById("edit-input").value;
					//未修改不提交
					if (value == plus.webview.currentWebview().value) {
						mui.toast('您没有更新数据');
						return;
					} else {
						user.updateuserinfo(att, value, function(data) {
							//console.log(data);
							if (data == 200) {
								//修改成功更新缓存
								var uinfo = persistent.uinfo();
								uinfo[plus.webview.currentWebview().attribute] = value
								//console.log(plus.webview.currentWebview().attribute)
								cache('uinfo', JSON.stringify(uinfo));
								mui.fire(plus.webview.getWebviewById('mycenter.html'),'reload',{})
								mui.fire(plus.webview.getWebviewById('userInfo'),'reload',{})
							} else {
								mui.toast("Error:");
							}
						});
					}
					mui.back();
				});
			});
		</script>
	</body>

</html>